The present disclosure relates in general to relational databases and more particularly, to the aggregation of keys of dependent objects for a given primary object of a hierarchical database.
Many businesses and institutions make use of relational databases to organize data in a form that is easy to access, organize, and manipulate. Relational databases store their metadata pertaining to user objects in relational tables called catalog tables. These catalog tables have inherent hierarchical relationships between them. For example, in an illustrative implementation of a relational database, a SYSTABLES catalog table (e.g., which holds the metadata about user tables) is related to a SYSTABLESPACES catalog table (e.g., which holds the metadata about tablespaces of the user tables). In this example, the primary key of the SYSTABLES catalog table can include multiple attributes, such as the name of the table and the creator of the table. The foreign keys of the SYSTABLES catalog table can include the name of the database and the name of the tablespace. As another example, a single foreign key may include multiple attributes, including the name of the database and the name of the tablespace. Correspondingly, the primary key of the SYSTABLESPACES catalog table can include multiple attributes, such as the name of the database and the name of the tablespace.
In the above exemplary configuration, given the primary keys of SYSTABLES, which describe the user tables in a corresponding database, it is possible to obtain the tablespace in which a given user table resides by querying the SYSTABLESPACE catalog table. Given the primary keys of the SYSTABLESPACES, which describe the database and tablespaces for a relational database, it is possible to obtain all the user tables residing in a given tablespace by querying the SYSTABLES catalog table.